﻿using UnityEngine;

namespace CommonLib
{
	//Template
	//单例Class示例
	public class Singleton<T> where T :new()
	{
		private static T m_Instance;
		public static T Instance
		{
			get
			{
				if (m_Instance == null)
				{
					m_Instance = new T();
				}

				return m_Instance;
			}
		}
		//将构造方法私有化 只通过Instance字段调用生成
		//private Singleton() { }
	}
}
